<template>
  <div>
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="流程名称" prop="workflowName">
        {{form.workflowName}}
        </el-form-item>
        <el-form-item label="业务类型" prop="applyScope">
          {{form.businessTypeName}}
        </el-form-item>
        <el-form-item label="使用范围" prop="extendId">
          {{applyScopeFormat(form.applyScope)}}
        </el-form-item>
      </el-form>
        <el-steps direction="vertical" style="margin-left: 100px;" space="80px">
          <el-step  v-for="item in form.nodeList" :title="item.nodeName" :key="item.nodeId"
            :description="item.approvalRolesName" ></el-step>
        </el-steps>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
    previewDefination
  } from "@/api/labdata/flowDefination";
  export default {
    name: "FlowPreview",
    data() {
      return {
        applyScopeOptions:[],
        title:'',
        // 遮罩层
        loading: true,
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {

        }
      };
    },
    created() {
      this.getDicts("applyScopeOpt").then(response => {
        this.applyScopeOptions = response.data;
      });
    },
    methods: {
      previewData(workflowId){
        previewDefination(workflowId).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "流程预览";
        });
      },
      // 状态字典翻译
      applyScopeFormat(applyScope) {
        return this.selectDictLabel(this.applyScopeOptions, applyScope);
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.form = {};
      },
    }
  };
</script>
<style type="text/css" lang="scss" scoped>
  .input_dialog_w{
        width: 240px;
    }
  .el-form-item {
      margin-bottom: 0px;
  }
</style>
